package com.xxxcompany.shop.servlet;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;



//ServletContextListener 			监听Servlet生命周期事件
// HttpSessionListener				监听Serssion生命周期事件
// ServletRequestListener				监听Request生命周期事件


// 监听域对象的事件
//ServletContextAttributeListener	
// HttpSessionAttributeListener	
//ServletRequestAttributeListener
@WebListener
public class Listener1 implements ServletContextListener,HttpSessionListener,ServletRequestListener 	
{

	@Override
	public void contextInitialized(ServletContextEvent sce) 
	{
		System.out.println("ServletContext 初始化了");
	}
	
	
	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		System.out.println("ServletContext 销毁了");
	}
	
	
	@Override
	public void sessionCreated(HttpSessionEvent se) 
	{
		System.out.println("会话 创建了");
	}
	
	@Override
	public void sessionDestroyed(HttpSessionEvent se) 
	{
		System.out.println("会话 销毁了");
	}
	
	@Override
	public void requestInitialized(ServletRequestEvent sre) {
		
		System.out.println("请求 创建了");
	}
	
	@Override
	public void requestDestroyed(ServletRequestEvent sre) {
		System.out.println("请求 销毁了");
		}
}